

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>feature</title>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<link rel="shortcut icon" href="../favicon.ico">
		<link href="../../css/bootstrap.min-lumen.css" rel="stylesheet">
		<link href="../../css/font-awesome.css?v=4.4.0" rel="stylesheet">
		<link href="../../css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
		<link href="../../css/animate.css" rel="stylesheet">
		<link href="../../css/style.css?v=4.1.0" rel="stylesheet">
		<link href="../../css/plugins/pageMe/pageMe.css" rel="stylesheet" />
		<link href="../../css/plugins/progressbar/mprogress.css" rel="stylesheet" />
		<link href="../../css/plugins/progressbar/style.css" rel="stylesheet" />
	</head>

	<body class="gray-bg">
		<div class="wrapper wrapper-content animated fadeInRight">

			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>用户信息表管理模块</h5>
				</div>
				<div class="ibox-content">
					<div class="row row-lg">
						<div class="clearfix hidden-xs"></div>
						<div class="col-sm-12">
							<!-- Example Checkbox Select -->
							<div class="example-wrap">

								<!-- 查询区域 -->
								<div id="queryModel">
											<input type="text" v-model="id" placeholder="主键id" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="userName" placeholder="用户名" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="userPassword" placeholder="登录密码" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="userEmail" placeholder="邮箱" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="sex" placeholder="性别（1：男，0：女）" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="age" placeholder="年龄" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="createBy" placeholder="创建人id" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="createTime" placeholder="创建时间" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="updateBy" placeholder="更新人id" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="updateTime" placeholder="更新时间" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="deleted" placeholder="是否删除（1：已删除，0：未删除）" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="isFollow" placeholder="是否关注公众号（1：已关注，0：已取消关注）" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="unfollowReason" placeholder="取消关注的原因" style="margin-top: 10px"/>&nbsp;
											<input type="text" v-model="followTime" placeholder="最新关注公众号的时间" style="margin-top: 10px"/>&nbsp;
									<button type="button" class="btn btn-primary btn-sm" @click="queryInfo()">查询</button>&nbsp;
									<button type="button" class="btn btn-primary btn-sm" @click="exportExcel()">导出excel</button>
								</div>
								<!-- 查询区域 end-->

								<!-- 添加数据区域 -->
								<div style="text-align: right;">
									<button type="button" class="btn btn-success btn-sm" onclick="addMsg()" style="margin: 8px">添加数据</button>
								</div>

								<!-- 查询结果表格显示区域 -->
								<div id="newsContent" class="table-responsive" style="overflow: scroll;" v-cloak>
									<table class="table table-hover table-bordered text-nowrap">
										<tr>
													<th>操作</th>
													<th>主键id</th>
													<th>用户名<a href='#' onclick='$crud.setAscColumn(this,"user_name")'>↑</a>&nbsp;<a href='#' onclick='$crud.setDescColumn(this,"user_name")'>↓</a></th>
													<th>登录密码</th>
													<th>邮箱</th>
													<th>性别（1：男，0：女）</th>
													<th>年龄</th>
													<th>创建人id</th>
													<th>创建时间<a href='#' onclick='$crud.setAscColumn(this,"create_time")'>↑</a>&nbsp;<a href='#' onclick='$crud.setDescColumn(this,"create_time")'>↓</a></th>
													<th>更新人id</th>
													<th>更新时间</th>
													<th>是否删除（1：已删除，0：未删除）</th>
													<th>是否关注公众号（1：已关注，0：已取消关注）</th>
													<th>取消关注的原因</th>
													<th>最新关注公众号的时间<a href='#' onclick='$crud.setAscColumn(this,"follow_time")'>↑</a>&nbsp;<a href='#' onclick='$crud.setDescColumn(this,"follow_time")'>↓</a></th>
										</tr>
										<tbody id="dataTable">
											<tr v-for="data in result">
												<td>
													 <button type="button" class="btn btn-info btn-sm" @click="upMsg(data.id,'/user/select')">更新</button>&nbsp;
													 <button type="button" class="btn btn-danger btn-sm" @click="delMsg(data.id,'/user/delete')">删除</button>&nbsp;
												</td>
												<td>{{data.id}}</td>
												<td>{{data.userName}}</td>
												<td>{{data.userPassword}}</td>
												<td>{{data.userEmail}}</td>
												<td>{{data.sex}}</td>
												<td>{{data.age}}</td>
												<td>{{data.createBy}}</td>
												<td>{{data.createTime}}</td>
												<td>{{data.updateBy}}</td>
												<td>{{data.updateTime}}</td>
												<td>{{data.deleted}}</td>
												<td>{{data.isFollow}}</td>
												<td>{{data.unfollowReason}}</td>
												<td>{{data.followTime}}</td>
											</tr>
										</tbody>
									</table>
									<div id="pageID" class="page_div"></div>
								</div>
								<!-- 查询结果表格显示区域 end-->
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<!-- 修改模态框 -->
		<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="updateModalLabel">修改信息</h4>
					</div>
					<div class="modal-body" id="updateModalBody">
						<form>
									<div class="form-group">
										<label for="id-attr" class="control-label">主键id:</label>
										<input type="text" class="form-control" id="id-attr" v-model="id"/>
									</div>
									<div class="form-group">
										<label for="userName-attr" class="control-label">用户名:</label>
										<input type="text" class="form-control" id="userName-attr" v-model="userName"/>
									</div>
									<div class="form-group">
										<label for="userPassword-attr" class="control-label">登录密码:</label>
										<input type="text" class="form-control" id="userPassword-attr" v-model="userPassword"/>
									</div>
									<div class="form-group">
										<label for="userEmail-attr" class="control-label">邮箱:</label>
										<input type="text" class="form-control" id="userEmail-attr" v-model="userEmail"/>
									</div>
									<div class="form-group">
										<label for="sex-attr" class="control-label">性别（1：男，0：女）:</label>
										<input type="text" class="form-control" id="sex-attr" v-model="sex"/>
									</div>
									<div class="form-group">
										<label for="age-attr" class="control-label">年龄:</label>
										<input type="text" class="form-control" id="age-attr" v-model="age"/>
									</div>
									<div class="form-group">
										<label for="createBy-attr" class="control-label">创建人id:</label>
										<input type="text" class="form-control" id="createBy-attr" v-model="createBy"/>
									</div>
									<div class="form-group">
										<label for="createTime-attr" class="control-label">创建时间:</label>
										<input type="text" class="form-control" id="createTime-attr" v-model="createTime"/>
									</div>
									<div class="form-group">
										<label for="updateBy-attr" class="control-label">更新人id:</label>
										<input type="text" class="form-control" id="updateBy-attr" v-model="updateBy"/>
									</div>
									<div class="form-group">
										<label for="updateTime-attr" class="control-label">更新时间:</label>
										<input type="text" class="form-control" id="updateTime-attr" v-model="updateTime"/>
									</div>
									<div class="form-group">
										<label for="deleted-attr" class="control-label">是否删除（1：已删除，0：未删除）:</label>
										<input type="text" class="form-control" id="deleted-attr" v-model="deleted"/>
									</div>
									<div class="form-group">
										<label for="isFollow-attr" class="control-label">是否关注公众号（1：已关注，0：已取消关注）:</label>
										<input type="text" class="form-control" id="isFollow-attr" v-model="isFollow"/>
									</div>
									<div class="form-group">
										<label for="unfollowReason-attr" class="control-label">取消关注的原因:</label>
										<input type="text" class="form-control" id="unfollowReason-attr" v-model="unfollowReason"/>
									</div>
									<div class="form-group">
										<label for="followTime-attr" class="control-label">最新关注公众号的时间:</label>
										<input type="text" class="form-control" id="followTime-attr" v-model="followTime"/>
									</div>
									<div class="form-group">
										<input type="hidden" class="form-control" id="id-attr" v-model="id"/>
									</div>
						</form>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" @click="confirmUp()">确认</button>
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>
			</div>
		</div>
	
		<!-- 添加模态框 -->
		<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="addModalLabel">添加信息</h4>
					</div>
					<div class="modal-body" id="addModalBody">
						<form>
									<div class="form-group">
										<label for="id-insert" class="control-label">主键id:</label>
										<input type="text" class="form-control" id="id-insert" v-model="id"/>
									</div>
									<div class="form-group">
										<label for="userName-insert" class="control-label">用户名:</label>
										<input type="text" class="form-control" id="userName-insert" v-model="userName"/>
									</div>
									<div class="form-group">
										<label for="userPassword-insert" class="control-label">登录密码:</label>
										<input type="text" class="form-control" id="userPassword-insert" v-model="userPassword"/>
									</div>
									<div class="form-group">
										<label for="userEmail-insert" class="control-label">邮箱:</label>
										<input type="text" class="form-control" id="userEmail-insert" v-model="userEmail"/>
									</div>
									<div class="form-group">
										<label for="sex-insert" class="control-label">性别（1：男，0：女）:</label>
										<input type="text" class="form-control" id="sex-insert" v-model="sex"/>
									</div>
									<div class="form-group">
										<label for="age-insert" class="control-label">年龄:</label>
										<input type="text" class="form-control" id="age-insert" v-model="age"/>
									</div>
									<div class="form-group">
										<label for="createBy-insert" class="control-label">创建人id:</label>
										<input type="text" class="form-control" id="createBy-insert" v-model="createBy"/>
									</div>
									<div class="form-group">
										<label for="createTime-insert" class="control-label">创建时间:</label>
										<input type="text" class="form-control" id="createTime-insert" v-model="createTime"/>
									</div>
									<div class="form-group">
										<label for="updateBy-insert" class="control-label">更新人id:</label>
										<input type="text" class="form-control" id="updateBy-insert" v-model="updateBy"/>
									</div>
									<div class="form-group">
										<label for="updateTime-insert" class="control-label">更新时间:</label>
										<input type="text" class="form-control" id="updateTime-insert" v-model="updateTime"/>
									</div>
									<div class="form-group">
										<label for="deleted-insert" class="control-label">是否删除（1：已删除，0：未删除）:</label>
										<input type="text" class="form-control" id="deleted-insert" v-model="deleted"/>
									</div>
									<div class="form-group">
										<label for="isFollow-insert" class="control-label">是否关注公众号（1：已关注，0：已取消关注）:</label>
										<input type="text" class="form-control" id="isFollow-insert" v-model="isFollow"/>
									</div>
									<div class="form-group">
										<label for="unfollowReason-insert" class="control-label">取消关注的原因:</label>
										<input type="text" class="form-control" id="unfollowReason-insert" v-model="unfollowReason"/>
									</div>
									<div class="form-group">
										<label for="followTime-insert" class="control-label">最新关注公众号的时间:</label>
										<input type="text" class="form-control" id="followTime-insert" v-model="followTime"/>
									</div>
						</form>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" @click="confirmAdd()">确认</button>
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>
			</div>
		</div>

		<!-- 全局js -->
		<script src="../../js/jquery.min.js?v=2.1.4"></script>
		<script src="../../js/bootstrap.min.js?v=3.3.6"></script>

		<!-- 自定义js -->
		<script src="../../js/content.js?v=1.0.0"></script>


		<!-- Bootstrap table -->
		<script src="../../js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
		<script src="../../js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
		<script src="../../js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

		<!-- Peity -->
		<!-- <script src="../../js/demo/bootstrap-table-demo.js"></script> -->
		<script src="../../js/vue/vue.min.js"></script>
		<script src="../../js/util/ajaxFactory.js"></script>
		<script src="../../js/util/crudVueFactory.js"></script>
		<script src="../../js/util/pageMe.js"></script>
		<script src="../../js/config/config.js"></script>
		<script src="../../js/plugins/layer/layer.min.js"></script>
		<script src="../../js/plugins/progressbar/init-mprogress.js"></script>
		<script src="../../js/plugins/progressbar/mprogress.js"></script>

		<script>
			var currentPage = 1;
			var totalPage;
			var sqlMap = {};
			//排序的数据
			var orderData = [];
			var controllerPrefix = "user";
			var methodName = "likeSelect";
	
			var queryVue = new Vue({
				el : '#queryModel',
				data : {
					id : '',
					userName : '',
					userPassword : '',
					userEmail : '',
					sex : '',
					age : '',
					createBy : '',
					createTime : '',
					updateBy : '',
					updateTime : '',
					deleted : '',
					isFollow : '',
					unfollowReason : '',
					followTime : ''
				},
				methods : {
					queryInfo : function() {
						sqlMap = {};
						sqlMap.id = this.id;
						sqlMap.userName = this.userName;
						sqlMap.userPassword = this.userPassword;
						sqlMap.userEmail = this.userEmail;
						sqlMap.sex = this.sex;
						sqlMap.age = this.age;
						sqlMap.createBy = this.createBy;
						sqlMap.createTime = this.createTime;
						sqlMap.updateBy = this.updateBy;
						sqlMap.updateTime = this.updateTime;
						sqlMap.deleted = this.deleted;
						sqlMap.isFollow = this.isFollow;
						sqlMap.unfollowReason = this.unfollowReason;
						sqlMap.followTime = this.followTime;
						currentPage = 1;
						orderData = [];
						$crud.getDataByCurrentPage();
					},
					exportExcel : function() {
	
						//显示进度条
						InitMprogress();
	
	                    var param = '';
	
	                    for (var key in sqlMap) {
                            if (sqlMap[key] != '') {
                                param += key + "=" + sqlMap[key] + "&";
                            }
	                    }
	
						window.location.href = basePath + "/" + controllerPrefix
								+ "/exportExcel?" + param;
						// 进度条消失
						setTimeout("MprogressEnd()", totalPage / 20 * 1000);
					}
				}
	
			});
	
			function makeResult(data) {
				for (var i = 0; i < data.length; i++) {
					if (data[i] == null) {
						data[i] = {};
						data[i]["id"] = "无";
						data[i]["userName"] = "无";
						data[i]["userPassword"] = "无";
						data[i]["userEmail"] = "无";
						data[i]["sex"] = "无";
						data[i]["age"] = "无";
						data[i]["createBy"] = "无";
						data[i]["createTime"] = "无";
						data[i]["updateBy"] = "无";
						data[i]["updateTime"] = "无";
						data[i]["deleted"] = "无";
						data[i]["isFollow"] = "无";
						data[i]["unfollowReason"] = "无";
						data[i]["followTime"] = "无";
					}
				}
			}
	
			var tableVue = new Vue({
				el : '#newsContent',
				data : {
					result : []
				},
				//created:
				mounted : function() {
					$crud.getDataByCurrentPage();
				},
				methods : {
	
					upMsg : function(id, path) {
	
						$z.ajaxStrAndJson({
							url : basePath + path,
							data : {
								id : id
							},
							success : function(data) {
								$z.dealCommonResult(data, function () {
									data = data.result;
									upVue.id = data[0]["id"];
									upVue.id = data[0]["id"];
									upVue.userName = data[0]["userName"];
									upVue.userPassword = data[0]["userPassword"];
									upVue.userEmail = data[0]["userEmail"];
									upVue.sex = data[0]["sex"];
									upVue.age = data[0]["age"];
									upVue.createBy = data[0]["createBy"];
									upVue.createTime = data[0]["createTime"];
									upVue.updateBy = data[0]["updateBy"];
									upVue.updateTime = data[0]["updateTime"];
									upVue.deleted = data[0]["deleted"];
									upVue.isFollow = data[0]["isFollow"];
									upVue.unfollowReason = data[0]["unfollowReason"];
									upVue.followTime = data[0]["followTime"];
									$('#updateModal').modal('show');
								});
							}
						});
					},
					delMsg : function(id, path) {
						layer.confirm("<em style='color:black'>" + '执行删除后将无法恢复，确定继续吗？' + "</em>", {
							icon: 3,
							offset: "200px",
							title: '温馨提示'
						}, function(index) {
							//do something 
							$z.ajaxStrAndJson({
								url: basePath + path,
								data: {
	                        		id : id
								},
								success: function(data) {
									$z.dealCommonResult(data, function () {
										$crud.getDataByCurrentPage();
										layer.alert("<em style='color:black'>" + "删除成功！" + "</em>", {
											icon: 6,
											offset: "200px",
											title: '提示'
										});
									});
								}
							});
							layer.close(index);
						});
					}
				}
			});
	
			var upVue = new Vue({
				el : "#updateModal",
				data : {
					id : '',
					id : '',
					userName : '',
					userPassword : '',
					userEmail : '',
					sex : '',
					age : '',
					createBy : '',
					createTime : '',
					updateBy : '',
					updateTime : '',
					deleted : '',
					isFollow : '',
					unfollowReason : '',
					followTime : ''
				},
				methods : {
					confirmUp : function() {
						$z.ajaxStrAndJson({
							url : basePath + "/" + controllerPrefix + "/update",
							data : {
								id : this.id,
								id : this.id,
								userName : this.userName,
								userPassword : this.userPassword,
								userEmail : this.userEmail,
								sex : this.sex,
								age : this.age,
								createBy : this.createBy,
								createTime : this.createTime,
								updateBy : this.updateBy,
								updateTime : this.updateTime,
								deleted : this.deleted,
								isFollow : this.isFollow,
								unfollowReason : this.unfollowReason,
								followTime : this.followTime
							},
							success : function(data) {
								$z.dealCommonResult(data, function () {
									layer.alert("<em style='color:black'>" + "更新成功！" + "</em>", {
										icon: 6,
										offset: "200px",
										title: '提示'
									});
									$('#updateModal').modal('hide');
									$crud.getDataByCurrentPage();
								});
	                            
							}
						});
					}
				}
			});
	
			function addMsg() {
				$('#addModal').modal('show');
			}
	
			var addVue = new Vue({
	
				el : "#addModal",
				data : {
					id : '',
					userName : '',
					userPassword : '',
					userEmail : '',
					sex : '',
					age : '',
					createBy : '',
					createTime : '',
					updateBy : '',
					updateTime : '',
					deleted : '',
					isFollow : '',
					unfollowReason : '',
					followTime : ''
				},
				methods : {
					confirmAdd : function() {
						$z.ajaxStrAndJson({
							url : basePath + "/" + controllerPrefix + "/add",
							data : {
								id : this.id,
								userName : this.userName,
								userPassword : this.userPassword,
								userEmail : this.userEmail,
								sex : this.sex,
								age : this.age,
								createBy : this.createBy,
								createTime : this.createTime,
								updateBy : this.updateBy,
								updateTime : this.updateTime,
								deleted : this.deleted,
								isFollow : this.isFollow,
								unfollowReason : this.unfollowReason,
								followTime : this.followTime
							},
							success : function(data) {
								$z.dealCommonResult(data, function () {
									layer.alert("<em style='color:black'>" + "添加成功！" + "</em>", {
										icon: 6,
										offset: "200px",
										title: '提示'
									});
									$('#addModal').modal('hide');
									//初始化
									sqlMap = {};
									currentPage = totalPage;
									orderData = [];
									$crud.getDataByCurrentPage();
								});
	                            
							}
						});
					}
				}
			});
		</script>
	</body>
</html>
